<!DOCTYPE html>
<html class="ui-page-login">

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>修改信息</title>
		<link href="mui/css/mui.min.css" rel="stylesheet" />
		<link href="mui/css/style.css" rel="stylesheet" />
		<style>
			.area {
				margin: 20px auto 0px auto;
			}
			.mui-input-group:first-child {
				margin-top: 20px;
			}
			.mui-input-group label {
				width: 25%;
			}
			.mui-input-row label~input,
			.mui-input-row label~select,
			.mui-input-row label~textarea {
				width: 75%;
			}
			.mui-checkbox input[type=checkbox],
			.mui-radio input[type=radio] {
				top: 6px;
			}
			.mui-content-padded {
				position: fixed;
				bottom: 10px;
				width: 80%;
			}
			.mui-btn {
				margin-left: 10%;
				padding: 10px;
			}
			
		</style>
	</head>

	<body>
		<div class="mui-content">
			<form class="mui-input-group">
				<div class="mui-input-row">
					<label>用户名</label>
					<input id='info' type="text" class="mui-input-clear mui-input" placeholder="">
				</div>
			</form>
			<div class="mui-content-padded">
				<button id='save' class="mui-btn mui-btn-block mui-btn-primary">保存</button>
			</div>
		</div>
		<script type="text/javascript" src="static/js/jquery-1.8.2.min.js"></script>
		<script type="text/javascript" src="layer/layer.js"></script>
		<script type="text/javascript" src="static/js/getparam.js"></script>
		<script>
			var $ctx = sessionStorage.getItem("basePath") + "/api";
			var type = $.Request("type");
			console.log(type)
			
			$("#save").click(function(){
				var userId = sessionStorage.getItem("userId");
				var info = $("#info").val();
				console.log(info)
				if(info != null && info != undefined && info != ''){
					$.ajax({
						type: "post",
						url: $ctx + "/sys/uptUserInfo",
						data: {
							'userId': userId,
							'info': info,
							'type':'user'
						},
						success: function(data) {
							console.log(data);
							if(data.code == 0){
								sessionStorage.setItem('username', info);
								layer.msg("保存成功！", {
									icon: 6,
									time: 2000, ////2秒关闭（如果不配置，默认是3秒）
								},function(){
									sessionStorage.setItem('from','uptInfo');
									window.location.href = 'index.html';
								});
							}else{
								layer.msg(data.msg, {icon: 5});
							}
						}
					});
				}else{
					layer.msg('请正确输入！', {icon: 2});
				}
			})
		</script>
	</body>

</html>